package com.ray.controller;

import java.io.File;
import java.io.IOException;
import java.io.OutputStream;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.jsp.tagext.PageData;

import org.apache.ibatis.annotations.Case;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.ray.bean.AttendanceRewardAndPunishBean;
import com.ray.bean.CompanyMaterialTableBean;
import com.ray.bean.CustomerBean;
import com.ray.bean.DatatablesViewPageBean;
import com.ray.bean.DepartmentBean;
import com.ray.bean.MaterialBean;
import com.ray.bean.PersonBean;
import com.ray.bean.TableData;
import com.ray.bean.UserBean;
import com.ray.bean.WorkshopProductionCycleBean;
import com.ray.exception.ServiceException;
import com.ray.mapper.BasicDataMapper;
import com.ray.pojo.AttendSourceRecordExportPojo;
import com.ray.pojo.AttendSourceRecordPojo;
import com.ray.pojo.BaseProcessDetailPojo;
import com.ray.pojo.MyUser;
import com.ray.pojo.attend.UserFinancePojo;
import com.ray.service.BasicDataService;
import com.ray.service.DingTalkService;
import com.ray.service.EquipmentService;
import com.ray.util.ExcelExportUtil;
import com.ray.util.RequestUtil;
import com.ray.util.ResponseUtil;
import com.ray.util.ReturnStringUtil;
import com.ray.util.baidu.BaiduSimilarPicSearchUtils;
import com.ray.util.baidu.Tags;
import com.ray.util.picUtil.PicUtils;
import com.ray.util.qiniu.QiniuConfig;
import com.ray.util.qiniu.QiniuUploadUtils;

/**
 * 基础数据表Controller
 */

@SuppressWarnings("unused")
@Controller
@RequestMapping("/basicData")
public class BasicDataController {
	@Autowired 
	BasicDataService basicDataService;
	@Autowired
	BasicDataMapper basicDataMapper;
	@Autowired
	EquipmentService equipmentService;
	@Autowired
	DingTalkService dingTalkService;
	
	//修改车间生产周期表数据
	@RequestMapping("/updateCycle")
	@ResponseBody
	public Map<String,Object> updateCycle(HttpServletRequest request) throws ServiceException {
		Map<String,Object> map=RequestUtil.getRequestParamByGeneric(request);
		basicDataService.updateCycle(map);
		return ResponseUtil.ResponseResult(ReturnStringUtil.UPDATE_SUCCESS);
	}
	//插入数据到车间生产周期表
	@RequestMapping("/insertCycle")
	@ResponseBody
	public Map<String,Object> insertCycle(HttpServletRequest request) throws ServiceException {
		Map<String,Object> map=RequestUtil.getRequestParamByGeneric(request);
		basicDataService.insertCycle(map);
		return ResponseUtil.ResponseResult(ReturnStringUtil.SUBMIT_SUCCESS);
	}
	//获取工序详情
	@RequestMapping("/getProcessDetail")
	@ResponseBody
	public Map<String,Object> getProcessDetail(HttpServletRequest request) throws ServiceException {
		Map<String,Object> map=RequestUtil.getRequestParamByGeneric(request);
		return ResponseUtil.ResponseResult(basicDataService.getProcessDetail(map));
	}
	//获取部门经理列表
	@RequestMapping("/getDeptManagerList")
	@ResponseBody
	public Map getDeptManagerList(HttpServletRequest request) throws ServiceException {
		MyUser myuser=RequestUtil.getLoginUser(request);
		return ResponseUtil.ResponseResult(basicDataService.getDeptManagerList(myuser));
	}
	//获取工序名称
	@RequestMapping("/getWorkingProcedureName")
	@ResponseBody
	public Map getWorkingProcedureName(HttpServletRequest request) throws ServiceException {
		Map map=RequestUtil.getRequestAllParam(request);
		return ResponseUtil.ResponseResult(basicDataService.getWorkingProcedureName(map));
	}
//公司物料表
	//查询所有物料
	@RequestMapping("/queryMaterialCompany")
	@ResponseBody
	public DatatablesViewPageBean queryMaterialCompany(HttpServletRequest request) throws ServiceException, ParseException {
		Map map=RequestUtil.getRequestAllParam(request);
		return basicDataService.queryMaterialCompany(map);
	}
	
	//查询物料是否使用
	@RequestMapping("/queryMaterialCompanyIsUsed")
	@ResponseBody
	public Map queryMaterialCompanyIsUsed(HttpServletRequest request) throws ServiceException, ParseException {
		Map map=RequestUtil.getRequestAllParam(request);
		return ResponseUtil.ResponseResult(basicDataService.queryMaterialCompanyIsUsed(map));
	}
	
	@RequestMapping("/queryMaterialCompanyByImg")
	@ResponseBody
	public com.alibaba.fastjson.JSONObject queryMaterialCompanyByImg(HttpServletRequest request,String imgUrl,int pn ,int rn) throws ServiceException, ParseException {
		Map map=RequestUtil.getRequestAllParam(request);
		MyUser myuser=RequestUtil.getLoginUser(request);
		return (com.alibaba.fastjson.JSONObject) com.alibaba.fastjson.JSONObject.parse(BaiduSimilarPicSearchUtils.similarPicSelectForRemote(Tags.getSameTag("0",myuser.getCompanyId()), imgUrl, 0, pn-1, rn).toString());
	}
	
	@RequestMapping("/queryShopMaterialCompanyByImg")
	@ResponseBody
	public com.alibaba.fastjson.JSONObject queryShopMaterialCompanyByImg(HttpServletRequest request,String imgUrl,int pn ,int rn) throws ServiceException, ParseException {
		return (com.alibaba.fastjson.JSONObject) com.alibaba.fastjson.JSONObject.parse(BaiduSimilarPicSearchUtils.similarPicSelectForRemote(Tags.getSameTag("4",65535), imgUrl, 1, pn-1, rn).toString());
	}
	
//公共物料表相关
	//查询所有物料
	@RequestMapping("/queryMaterial")
	@ResponseBody
	public DatatablesViewPageBean queryMaterial(HttpServletRequest request) throws ServiceException, ParseException {
		Map map=RequestUtil.getRequestAllParam(request);
		return basicDataService.queryMaterial(map);
	}
	//获取物料详情
	@RequestMapping("/getCompanyMaterialDetail")
	@ResponseBody
	public Map getCompanyMaterialDetail(HttpServletRequest request) throws ServiceException {
		Map map=RequestUtil.getRequestAllParam(request);
		return ResponseUtil.ResponseResult(basicDataService.getCompanyMaterialDetail(map));
	}
	//获取物料详情
	@RequestMapping("/getMaterialDetail")
	@ResponseBody
	public Map getMaterialDetail(HttpServletRequest request) throws ServiceException {
		Map map=RequestUtil.getRequestAllParam(request);
		return ResponseUtil.ResponseResult(basicDataService.getMaterialDetail(map));
	}
	//获取物料代码
	@RequestMapping("/getMaterialCode")
	@ResponseBody
	public Map getMaterialCode() {
		return ResponseUtil.ResponseResult(basicDataService.getMaterialCode());
	}
	//获取公司物料代码
	@RequestMapping("/getCompanyMaterialCode")
	@ResponseBody
	public Map getCompanyMaterialCode(HttpServletRequest request) throws ServiceException {
		Map map=RequestUtil.getRequestAllParam(request);
		return ResponseUtil.ResponseResult(basicDataService.getCompanyMaterialCode(map));
	}
	//根据物料代码代码获取物料名称
	@RequestMapping("/getMaterialNameByCode")
	@ResponseBody
	public Map getMaterialNameByCode(String materialCode) {
		return ResponseUtil.ResponseResult(basicDataService.getMaterialNameByCode(materialCode));
	}
	//获取物料名称
	@RequestMapping("/getMaterialName")
	@ResponseBody
	public Map getMaterialName() {
		return ResponseUtil.ResponseResult(basicDataService.getMaterialName());
	}
	//获取公司物料名称
	@RequestMapping("/getCompanyMaterialName")
	@ResponseBody
	public Map getCompanyMaterialName(HttpServletRequest request) throws ServiceException {
		Map map=RequestUtil.getRequestAllParam(request);
		return ResponseUtil.ResponseResult(basicDataService.getCompanyMaterialName(map));
	}
	//获取规格型号
	@RequestMapping("/getModel")
	@ResponseBody
	public Map getModel() {
		return ResponseUtil.ResponseResult(basicDataService.getModel());
	}
	//获取公司物料表规格型号
	@RequestMapping("/getCompanyModel")
	@ResponseBody
	public Map getCompanyModel(HttpServletRequest request) throws ServiceException {
		Map map=RequestUtil.getRequestAllParam(request);
		return ResponseUtil.ResponseResult(basicDataService.getCompanyModel(map));
	}
	//获取单位
	@RequestMapping("/getUnit")
	@ResponseBody
	public Map getUnit() {
		return ResponseUtil.ResponseResult(basicDataService.getUnit());
	}
	//获取公司单位
	@RequestMapping("/getCompanyUnit")
	@ResponseBody
	public Map getCompanyUnit(HttpServletRequest request) throws ServiceException {
		Map map=RequestUtil.getRequestAllParam(request);
		return ResponseUtil.ResponseResult(basicDataService.getCompanyUnit(map));
	}
	//获取默认仓库
	@RequestMapping("/getDefaultWarehouse")
	@ResponseBody
	public Map getDefaultWarehouse() {
		return ResponseUtil.ResponseResult(basicDataService.getDefaultWarehouse());
	}
	//获取公司默认仓库
	@RequestMapping("/getCompanyDefaultWarehouse")
	@ResponseBody
	public Map getCompanyDefaultWarehouse(HttpServletRequest request) throws ServiceException {
		Map map=RequestUtil.getRequestAllParam(request);
		return ResponseUtil.ResponseResult(basicDataService.getCompanyDefaultWarehouse(map));
	}
	//获取供应商名称
	@RequestMapping("/getProviderName")
	@ResponseBody
	public Map getProviderName() {
		return ResponseUtil.ResponseResult(basicDataService.getProviderName());
	}
	
	//获取有效的供应商名称
	@RequestMapping("/getValidProviderName")
	@ResponseBody
	public Map getValidProviderName(HttpServletRequest request) throws ServiceException {
		Map map = RequestUtil.getRequestAllParam(request);
		return ResponseUtil.ResponseResult(basicDataService.getValidProviderName(map));
	}
	//获取公司供应商名称
	@RequestMapping("/getCompanyProviderName")
	@ResponseBody
	public Map getCompanyProviderName(HttpServletRequest request) throws ServiceException {
		Map map=RequestUtil.getRequestAllParam(request);
		return ResponseUtil.ResponseResult(basicDataService.getCompanyProviderName(map));
	}
	//获取物料类型
	@RequestMapping("/getMaterialType")
	@ResponseBody
	public Map getMaterialType() {
		return ResponseUtil.ResponseResult(basicDataService.getMaterialType());
	}
	//获取公司物料类型
	@RequestMapping("/getCompanyMaterialType")
	@ResponseBody
	public Map getCompanyMaterialType(HttpServletRequest request) throws ServiceException {
		Map map=RequestUtil.getRequestAllParam(request);
		return ResponseUtil.ResponseResult(basicDataService.getCompanyMaterialType(map));
	}
	//获取色号
	@RequestMapping("/getColor")
	@ResponseBody
	public Map getColor() {
		return ResponseUtil.ResponseResult(basicDataService.getColor());
	}
	//获取公司色号
	@RequestMapping("/getCompanyColor")
	@ResponseBody
	public Map getCompanyColor(HttpServletRequest request) throws ServiceException {
		Map map=RequestUtil.getRequestAllParam(request);
		return ResponseUtil.ResponseResult(basicDataService.getCompanyColor(map));
	}
	//根据色号获取色号描述
	@RequestMapping("/getColorDescription")
	@ResponseBody
	public Map getColorDescription(String color) {
		return ResponseUtil.ResponseResult(basicDataService.getColorDescription(color));
	}
	//根据色号获取公司物料表色号描述
	@RequestMapping("/getCompanyColorDescription")
	@ResponseBody
	public Map getCompanyColorDescription(HttpServletRequest request) throws ServiceException {
		Map map=RequestUtil.getRequestAllParam(request);
		return ResponseUtil.ResponseResult(basicDataService.getCompanyColorDescription(map));
	}
	//修改物料
	@RequestMapping("/updateMaterial")
	@ResponseBody
	public Map updateMaterial(MaterialBean materialBean,HttpServletRequest request) throws ServiceException {
		MyUser myuser=RequestUtil.getLoginUser(request);
		basicDataService.updateMaterial(materialBean,myuser);
		return ResponseUtil.ResponseResult("修改成功");
	}
	//修改公司物料
	@RequestMapping("/updateCompanyMaterial")
	@ResponseBody
	public Map updateCompanyMaterial(CompanyMaterialTableBean materialBean,HttpServletRequest request) throws Exception {
		MyUser myuser=RequestUtil.getLoginUser(request);
		basicDataService.updateCompanyMaterial(materialBean,myuser);
		return ResponseUtil.ResponseResult("修改成功");
	}
	
	//修改公司物料是否为现货的属性
	@RequestMapping("/updateCompanyMaterialIsSpot")
	@ResponseBody
	public Map updateCompanyMaterialIsSpot(CompanyMaterialTableBean materialBean,HttpServletRequest request) throws Exception {
		MyUser myuser=RequestUtil.getLoginUser(request);
		basicDataService.updateCompanyMaterialIsSpot(materialBean,myuser);
		return ResponseUtil.ResponseResult("修改成功");
	}
	
	//修改公司物料信息是否显示
	@RequestMapping("/updateCompanyMaterialConfig")
	@ResponseBody
	public Map updateCompanyMaterialConfig(CompanyMaterialTableBean materialBean,HttpServletRequest request) throws Exception {
		MyUser myuser=RequestUtil.getLoginUser(request);
		basicDataService.updateCompanyMaterialConfig(materialBean,myuser);
		return ResponseUtil.ResponseResult("修改成功");
	}
	//添加物料
	@RequestMapping("/insertMaterial")
	@ResponseBody
	public Map insertMaterial(MaterialBean materialBean,HttpServletRequest request) throws ServiceException {
		MyUser myuser=RequestUtil.getLoginUser(request);
		basicDataService.insertMaterial(materialBean,myuser);
		return ResponseUtil.ResponseResult("添加成功");
	}
	//添加公司物料
	@RequestMapping("/insertCompanyMaterial")
	@ResponseBody
	public Map insertCompanyMaterial(CompanyMaterialTableBean materialBean,HttpServletRequest request) throws ServiceException {
		MyUser myuser=RequestUtil.getLoginUser(request);
		return ResponseUtil.ResponseResult(basicDataService.insertCompanyMaterial(materialBean,myuser));
	}
	
//职员表相关
	//获取职员详情
	@RequestMapping("/queryPersonnel")
	@ResponseBody
	public DatatablesViewPageBean queryPersonnel(HttpServletRequest request) throws ServiceException {
		Map map=RequestUtil.getRequestAllParam(request);
		return basicDataService.queryPersonnel(map);
	}
	
	/**
	 * 导出无效打卡时间原始记录
	 * @param request
	 * @return
	 * @author 王荣
	 */
	@RequestMapping(value="/exprotExcelPersonnel",method=RequestMethod.GET)
	@ResponseBody
	public void exprotExcelPersonnel(HttpServletRequest request,HttpServletResponse response) throws ServiceException, CloneNotSupportedException, NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException, IOException{
		ObjectMapper MAPPER = new ObjectMapper();
		Map<String,Object> map=RequestUtil.getRequestParamByGeneric(request);
		map.put("start", null);
		map.put("length", null);
		List<AttendanceRewardAndPunishBean> attendanceRewardAndPunishBeans= dingTalkService.getRewardAndPunishInfo(map);
		DatatablesViewPageBean datatablesViewPageBean=basicDataService.queryPersonnel(map);
		List<UserFinancePojo> tableList= datatablesViewPageBean.getReturnData();
		//用于打印的数据
		List<UserFinancePojo> list = new ArrayList<UserFinancePojo>();
		//转换对象
		for(UserFinancePojo personBean : tableList) {
			String jsonStr = MAPPER.writeValueAsString(personBean);
			UserFinancePojo detail = MAPPER.readValue(jsonStr , UserFinancePojo.class);
			if(detail.getDuty().equals("1")) {
				detail.setDuty("经理");
			}
			if(detail.getDuty().equals("2")) {
				detail.setDuty("主管");
			}
			if(detail.getDuty().equals("3")) {
				detail.setDuty("职员");
			}
			//请假
			AttendanceRewardAndPunishBean leve = dingTalkService.getAttendanceRewardAndPunishBeanByRank(attendanceRewardAndPunishBeans, detail.getRatioLeave()+"");
			if(leve!=null)detail.setRatioLeaveStr(detail.getRatioLeave().toString()+"档(1:"+leve.getLeave()+")");
			//旷工
			AttendanceRewardAndPunishBean absent = dingTalkService.getAttendanceRewardAndPunishBeanByRank(attendanceRewardAndPunishBeans, detail.getRatioAbsent()+"");
			if(absent!=null)detail.setRatioAbsentStr(detail.getRatioAbsent().toString()+"档(1:"+absent.getLeave()+")");
			//加班
			AttendanceRewardAndPunishBean overtime = dingTalkService.getAttendanceRewardAndPunishBeanByRank(attendanceRewardAndPunishBeans, detail.getRatioOvertime()+"");
			if(overtime!=null)detail.setRatioOvertimeStr(detail.getRatioOvertime().toString()+"档(1:"+overtime.getLeave()+")");
			list.add(detail);
		}
		//表头字段
		String [] tableHeadFields={"编号","工号","职员名称","部门","职务","基本工资(元)","请假(比例)","旷工(比例)","加班(比例)","社保扣款(元)","公积金扣款(元)","其他扣款(元)","其他加项(元)"};
		//对应的内容字段
		String [] fields={"personId","workerNo","personName","deptName","duty","monthlySalary","ratioLeaveStr","ratioAbsentStr","ratioOvertimeStr","socialSecurity","accumulationFund","otherAddition","otherDeductions"};
		String tempFolder=request.getServletContext().getRealPath("/")+"tempExcelFolder";
		File excelFile=ExcelExportUtil.createExcelFileWithStyle(list,tempFolder,tableHeadFields,fields,"职员工资明细");
		ResponseUtil.downloadfile(response, excelFile, "职员工资明细.xlsx", true);
	}
	
	@RequestMapping(value="/exportpRrocessDetail",method=RequestMethod.GET)
	@ResponseBody
	public void exportpRrocessDetail (HttpServletRequest request,HttpServletResponse response) throws IOException, NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException {
		Map<String,Object> map=RequestUtil.getRequestParamByGeneric(request);
		List<BaseProcessDetailPojo> list = basicDataService.getProcessDetail(map);
		for(BaseProcessDetailPojo pp:list) {
			pp.setReportModeStr();
			pp.setIsNeedReviewedStr();
		}
		//表头字段
		String [] tableHeadFields={"工序代码","部门","车间名称","工序名称","报工方式","状态","加工对象","工序作业时间(秒)","工序交接时间(秒)","顺序","计价单位","计时单位","单价","是否需要审核"};
		//对应的内容字段
		String [] fields={"processCode","deptName","workName","processName","reportModeStr","status","processingObject","workingProcedureDuration","handoverTime","sort","chargeUnit","timeUnit","unitPrice","isNeedReviewedStr"};
		String tempFolder=request.getServletContext().getRealPath("/")+"tempExcelFolder";
		File excelFile=ExcelExportUtil.createExcelFileWithStyle(list,tempFolder,tableHeadFields,fields,"职员工资明细");
		ResponseUtil.downloadfile(response, excelFile, "工序表明细.xlsx", true);
	}
	
	//根据部门名称获取相应的职员
	@RequestMapping("/getPersonName")
	@ResponseBody
	public Map getPersonName(HttpServletRequest request) throws ServiceException {
		Map map=RequestUtil.getRequestAllParam(request);
		return ResponseUtil.ResponseResult(basicDataService.getPersonName(map));
	}
	//获取职员详情
	@RequestMapping("/getPersonDetail")
	@ResponseBody
	public Map getPersonDetail(String id) throws ServiceException {
//		MyUser myuser=RequestUtil.getLoginUser(request);
		return ResponseUtil.ResponseResult(basicDataService.getPersonDetail(id));
	}
	//update职员
	@RequestMapping("/updatePerson")
	@ResponseBody
	public Map updatePerson(HttpServletRequest request) throws ServiceException {
		Map<String,Object> map=RequestUtil.getRequestAllParam(request);
		basicDataService.updatePerson(map);
		return ResponseUtil.ResponseResult("修改成功");
	}
	//insert职员
	@RequestMapping("/insertPerson")
	@ResponseBody
	public Map<String,Object> insertPerson(PersonBean personBean,HttpServletRequest request) throws ServiceException {
		MyUser myuser=RequestUtil.getLoginUser(request);
		Map<String,Object> map=RequestUtil.getRequestParamByGeneric(request);
		basicDataService.insertPerson(personBean,map);
		return ResponseUtil.ResponseResult("添加成功");
	}
	/**
	 * 用于领料单 获取公司物料表中正在使用的并且库存数量不为零的  at 2018-04-04 by 李斌
	 * @param request
	 * @return
	 * @throws ServiceException
	 */
	@RequestMapping("/getCompanyMaterialNameByCount")
	@ResponseBody 
	public Map getCompanyMaterialNameByCount(HttpServletRequest request) throws ServiceException{
		@SuppressWarnings("rawtypes")
		Map map = RequestUtil.getRequestAllParam(request);
		return ResponseUtil.ResponseResult(basicDataService.getCompanyMaterialNameByCount(map));
	}
	
	/**
	* @Description: 用于领料单 获取物料规格从公司物料表中正在使用的物料并且库存数量不为零通过物料名称筛选
	* @date 2018年4月4日 上午8:45:55 
	* @author 李斌
	* @return Map 
	 */ 
	@RequestMapping("/getModelByCountAndMaterialName")
	@ResponseBody
	public Map getModelByCountAndMaterialName(HttpServletRequest request) throws ServiceException{
		@SuppressWarnings("rawtypes")
		Map map = RequestUtil.getRequestAllParam(request);
		return ResponseUtil.ResponseResult(basicDataService.getModelByCountAndMaterialName(map));
	} 
	/**
	 * @throws ServiceException 
	 * 用于领料单 获取物料的默认仓库通过公司物料表中正在使用的物料并且库存数量不为零通过物料名称筛选
	* @date 2018年4月4日 上午9:25:24 
	* @author 李斌
	* @return Map 
	* @throws
	 */
	@RequestMapping("/getDefaultWarehouseByCountAndMaterialName")
	@ResponseBody
	public Map getDefaultWarehouseByCountAndMaterialName(HttpServletRequest requset) throws ServiceException {
		Map map = RequestUtil.getRequestAllParam(requset);
		return ResponseUtil.ResponseResult(basicDataService.getDefaultWarehouseByCountAndMaterialName(map));
	}
	/**
	 * 用于领料单 获取物料的供应商名称通过公司物料表中正在使用的物料并且库存数量不为零通过物料名称筛选
	* @date 2018年4月4日 上午9:43:31 
	* @author 李斌
	* @return Map 
	* @throws
	 */
	@RequestMapping("/getProviderNameByCountAndMaterialName")
	@ResponseBody
	public Map getProviderNameByCountAndMaterialName(HttpServletRequest request) throws ServiceException {
		Map map = RequestUtil.getRequestAllParam(request);
		return ResponseUtil.ResponseResult(basicDataService.getProviderNameByCountAndMaterialName(map));
	}
	/**
	 * 用于领料单 获取物料的物料类型通过公司物料表中正在使用的物料并且库存数量不为零通过物料名称筛选
	* @date 2018年4月4日 上午9:54:11 
	* @author 李斌
	* @return Map 
	* @throws
	 */ 
	@RequestMapping("/getMaterialTypeByCountAndMaterialName")
	@ResponseBody
	public Map getMaterialTypeByCountAndMaterialName(HttpServletRequest request) throws ServiceException {
		Map map = RequestUtil.getRequestAllParam(request);
		return ResponseUtil.ResponseResult(basicDataService.getMaterialTypeByCountAndMaterialName(map));
	}
	/**
	 * @throws ServiceException 
	 * 用于领料单 获取物料的色号通过公司物料表中正在使用的物料并且库存数量不为零通过物料名称筛选
	* @date 2018年4月4日 上午10:10:55 
	* @author 李斌
	* @return Map 
	* @throws
	 */
	@RequestMapping("/getColorByCountAndMaterialName")
	@ResponseBody
	public Map getColorByCountAndMaterialName(HttpServletRequest request) throws ServiceException {
		Map map = RequestUtil.getRequestAllParam(request);
		return ResponseUtil.ResponseResult(basicDataService.getColorByCountAndMaterialName(map));
	}
	/**
	 * 获取剩余可领取的库存数
	* @date 2018年4月4日 上午10:53:31 
	* @author 李斌
	* @return Map 
	* @throws
	 */
	@RequestMapping("/getSurplusAmount")
	@ResponseBody
	public Map getSurplusAmount(HttpServletRequest request) throws ServiceException {
		@SuppressWarnings("rawtypes")
		Map map = RequestUtil.getRequestAllParam(request);
		return ResponseUtil.ResponseResult(basicDataService.getSurplusAmount(map));
	}
	
//部门表相关
	//获取部门详情
	@RequestMapping("/queryDept")
	@ResponseBody
	public DatatablesViewPageBean queryDept(HttpServletRequest request) throws ServiceException {
		Map map=RequestUtil.getRequestAllParam(request);
		return basicDataService.queryDept(map);
	}
	//获取部门名称
	@RequestMapping("/getDeptName")
	@ResponseBody
	public Map getDeptName(HttpServletRequest request) throws ServiceException {
		Map map=RequestUtil.getRequestAllParam(request);
		return ResponseUtil.ResponseResult(basicDataService.getDeptName(map));
	}
	//获取部门详情
	@RequestMapping("/getDeptDetail")
	@ResponseBody
	public Map getDeptDetail(HttpServletRequest request) throws ServiceException {
		Map map=RequestUtil.getRequestAllParam(request);
		return ResponseUtil.ResponseResult(basicDataService.getDeptDetail(map.get("deptName").toString(),map.get("loginCompany").toString(),map.get("view").toString()));
	}
	//update部门表
	@RequestMapping("/updateDept")
	@ResponseBody
	public Map updateDept(DepartmentBean departmentBean,HttpServletRequest request) throws ServiceException {
		Map map=RequestUtil.getRequestAllParam(request);
		basicDataService.updateDept(departmentBean,map);
		return ResponseUtil.ResponseResult("修改成功");
	}
	//insert部门表
	@RequestMapping("/insertDept")
	@ResponseBody
	public Map insertDept(DepartmentBean departmentBean,HttpServletRequest request) throws ServiceException {
		MyUser myuser=RequestUtil.getLoginUser(request);
		basicDataService.insertDept(departmentBean,myuser);
		return ResponseUtil.ResponseResult("插入成功");
	}
	
//客户表相关
	//查询所有客户
	@RequestMapping("/queryCustomers")
	@ResponseBody
	public DatatablesViewPageBean queryCustomers(HttpServletRequest request) throws ServiceException {
		Map map=RequestUtil.getRequestAllParam(request);
		return basicDataService.queryCustomers(map);
	}
	
	@RequestMapping("/queryCustomersTow")
	@ResponseBody
	public DatatablesViewPageBean queryCustomersTow(HttpServletRequest request) throws ServiceException {
		Map map=RequestUtil.getRequestAllParam(request);
		return basicDataService.queryCustomerTows(map);
	} 
	
	@RequestMapping("/queryCustomersSubTwo")
	@ResponseBody
	public DatatablesViewPageBean queryCustomersSubTwo(HttpServletRequest request) throws ServiceException {
		Map map=RequestUtil.getRequestAllParam(request);
		return basicDataService.queryCustomerSubTows(map);
	} 
	/**
	 * 
	 * Title: getCustomerCode
	 * Description: 获取物料代码 
	 * @param request
	 * @return
	 * @throws ServiceException  
	 * @author 王荣
	 * @date 2018年4月19日 下午1:52:32
	 */
	@RequestMapping("/getCustomerCode")
	@ResponseBody
	public Map getCustomerCode(HttpServletRequest request) throws ServiceException {
		Map map=RequestUtil.getRequestAllParam(request);
		return ResponseUtil.ResponseResult(basicDataService.getCustomerCode(map));
	}
	
	/**
	 * 
	 * Title: getCustomerCode
	 * Description: 获取物料代码 
	 * @param request
	 * @return
	 * @throws ServiceException  
	 * @author 王荣
	 * @date 2018年4月19日 下午1:52:32
	 */
	@RequestMapping("/getCustomerSubCode")
	@ResponseBody
	public Map getCustomerSubCode(HttpServletRequest request) throws ServiceException {
		Map map=RequestUtil.getRequestAllParam(request);
		return ResponseUtil.ResponseResult(basicDataService.getCustomerSubCode(map));
	}
	//获取客户名称
	@RequestMapping("/getCustomerName")
	@ResponseBody
	public Map getCustomerName(HttpServletRequest request) throws ServiceException {
		Map map=RequestUtil.getRequestAllParam(request);
		return ResponseUtil.ResponseResult(basicDataService.getCustomerName(map));
	}
	//获取客户详情
	@RequestMapping("/getCustomerDetail")
	@ResponseBody
	public Map getCustomerDetail(HttpServletRequest request) throws ServiceException {
		Map map=RequestUtil.getRequestAllParam(request);
		return ResponseUtil.ResponseResult(basicDataService.getCustomerDetail(map));
	}
	//修改客户信息
	@RequestMapping("/updateCustomer")
	@ResponseBody
	public Map updateCustomer(HttpServletRequest request) throws ServiceException, ParseException {
		Map map=RequestUtil.getRequestAllParam(request);
		basicDataService.updateCustomer(map);
		return ResponseUtil.ResponseResult("修改成功");
	}
	//修改客户信息子公司
	@RequestMapping("/updateCustomerSub")
	@ResponseBody
	public Map updateCustomerSub(HttpServletRequest request) throws ServiceException, ParseException {
		Map map=RequestUtil.getRequestAllParam(request);
		basicDataService.updateCustomerSub(map);
		return ResponseUtil.ResponseResult("修改成功");
	}
	//插入客户信息
	@RequestMapping("/insertCustomer")
	@ResponseBody
	public Map insertCustomer(CustomerBean customerBean,HttpServletRequest request) throws ServiceException {
		MyUser myuser=RequestUtil.getLoginUser(request);
		basicDataService.insertCustomer(customerBean,myuser);
		return ResponseUtil.ResponseResult("插入成功");
	}
	
	//插入客户信息
	@RequestMapping("/insertCustomerSub")
	@ResponseBody
	public Map insertCustomerSub(CustomerBean customerBean,HttpServletRequest request) throws ServiceException {
		MyUser myuser=RequestUtil.getLoginUser(request);
		basicDataService.insertCustomerSub(customerBean,myuser);
		return ResponseUtil.ResponseResult("插入成功");
	}
		
	//查询所有工序
	@RequestMapping("/queryProcess")
	@ResponseBody
	public DatatablesViewPageBean queryProcess(HttpServletRequest request) throws ServiceException {
		Map map=RequestUtil.getRequestAllParam(request);
		return basicDataService.queryProcess(map);
	}
//	@RequestMapping("/queryProcess")
//	@ResponseBody
//	public Map queryProcess() throws ServiceException {
//		return ResponseUtil.ResponseResult(basicDataService.queryProcess());
//	}
	//查询所有周期
	@RequestMapping("/queryCycle")
	@ResponseBody
	/*public Map queryCycle(HttpServletRequest request) throws ServiceException {
		MyUser myuser=RequestUtil.getLoginUser(request);
		return ResponseUtil.ResponseResult(basicDataService.queryCycle(myuser));
	}*/
	public DatatablesViewPageBean queryCycle(HttpServletRequest request) throws ServiceException {
		Map map=RequestUtil.getRequestAllParam(request);
		return basicDataService.queryCycle(map);
	}
//	获取所有车间名称
	@RequestMapping("/getWorkshopName")
	@ResponseBody
	public Map getWorkshopName(HttpServletRequest request) throws ServiceException{
		Map map=RequestUtil.getRequestAllParam(request);
		return ResponseUtil.ResponseResult(basicDataService.getWorkshopName(map));
	}
	/**
	 * 
	 * Title: getWorkshopNameByDeptId
	 * Description: 通过部门id获取车间信息  
	 * @param request
	 * @return
	 * @throws ServiceException  
	 * @author 王荣
	 * @date 2018年4月7日 下午6:42:12
	 */
	@RequestMapping("/getWorkshopNameByDeptId")
	@ResponseBody
	public Map getWorkshopNameByDeptId(HttpServletRequest request) throws ServiceException{
		Map map=RequestUtil.getRequestAllParam(request);
		return ResponseUtil.ResponseResult(basicDataService.getWorkshopNameByDeptId(map));
	}
	/**
	 * 
	 * Title: getDeptId2
	 * Description: 通过部门名称，获取对应部门的车间信息
	 * @param request
	 * @return
	 * @throws ServiceException  
	 * @author 王荣
	 * @date 2018年4月8日 下午4:46:39
	 */
	@RequestMapping("/getDeptId2")
	@ResponseBody
	public Map getDeptId2(HttpServletRequest request) throws ServiceException{
		Map map=RequestUtil.getRequestAllParam(request);
		return ResponseUtil.ResponseResult(basicDataService.getDeptId2(map));
	}
	
//	获取所有车间名称和id
	/**
	 * 获取车间信息
	 * @author nateLu
	 * @param request
	 * @return
	 * @throws ServiceException
	 */
	@RequestMapping("/getWorkshop")
	@ResponseBody
	public Map getWorkshop(HttpServletRequest request) throws ServiceException{
//		Date date=new Date();
//		System.out.println("开始"+date.getTime());
		Map map=RequestUtil.getRequestAllParam(request);
		List<WorkshopProductionCycleBean> xx=basicDataService.getWorkshop(map);
//		Date date2=new Date();
//		System.out.println("结束"+date2.getTime());
//		System.out.println(date2.getTime()-date.getTime());
		return ResponseUtil.ResponseResult(xx);
	}
	
	
	/**
	 * 根据车间id查找工序
	 * @author natelu
	 * @param request
	 * @return
	 * @throws ServiceException
	 */
	@RequestMapping("/getWorkingProcedureByWorkId")
	@ResponseBody
	public Map getWorkingProcedureByWorkId(HttpServletRequest request) throws ServiceException{
		Map map=RequestUtil.getRequestAllParam(request);
		return ResponseUtil.ResponseResult(basicDataService.getWorkingProcedureByWorkId(map));
	}
	
	
	/**
	 * 查找订单物料信息
	 * @author natelu
	 * @param request
	 * @return
	 * @throws ServiceException
	 */
	@RequestMapping("/getOrderMaterial")
	@ResponseBody
	public DatatablesViewPageBean getOrderMaterial(HttpServletRequest request) throws ServiceException {
		Map map=RequestUtil.getRequestAllParam(request);
		return basicDataService.getOrderMaterial(map);
	}
	
	
	/**
	 * 获取车间分页数据
	 * @author natelu
	 * @param deptId(部门id  非必传)
	 * @param workShopId(车间id 非必传)
	 * @param selectWhere(模糊查车间名称)
	 * @return
	 * @throws ServiceException
	 */
	@RequestMapping("/getWorkShopPage")
	@ResponseBody
	public DatatablesViewPageBean getWorkShopPage(HttpServletRequest request) throws ServiceException {
		Map map=RequestUtil.getRequestAllParam(request);
		return basicDataService.getWorkShopPage(map);
	}

	
	/**
	 * 没有用到  作废 nate 
	 * 用于无采购单入库 保存公司物料表和入库表 at 2018-04-01 by 李斌	
	 * @throws ServiceException 
	 */
	@RequestMapping("/insertCompanyMaterialAndWarehouse")
	@ResponseBody
	public Map insertCompanyMaterialAndWarehouse(HttpServletRequest request) throws ServiceException {
		Map map = RequestUtil.getRequestAllParam(request);
		basicDataService.insertCompanyMaterialAndWarehouse(map);
		return ResponseUtil.ResponseResult("保存成功");
		
	}
	/**
	 * 保存公司物料表和订单明细表 at 2018-03-29 by 李斌
	 * @param request
	 * @return
	 * @throws ServiceException
	 */
	@RequestMapping("/updateCompanyMaterialAndOrderInfoDetail")
	@ResponseBody
	public Map updateBasicDataAndOrderInfoDetail(HttpServletRequest request) throws ServiceException{
		Map map = RequestUtil.getRequestAllParamNotLogin(request);
		MyUser myUser = RequestUtil.getLoginUser(request);
		basicDataService.updateBasicDataAndOrderInfoDetail(map,myUser);
		return ResponseUtil.ResponseResult("保存成功");
	}
	/**
	 * 更新订单明细表,通过物料代码
	* @date 2018年4月19日 下午3:22:45 
	* @author 李斌
	* @return Map 
	* @throws
	 */
	@RequestMapping("/updateOrderInfoDetailByCompanyMaterialCode")
	@ResponseBody
	public Map updateOrderInfoDetailByCompanyMaterialCode(HttpServletRequest request) throws ServiceException {
		Map map = RequestUtil.getRequestAllParam(request);
		int flag = basicDataService.updateOrderInfoDetailByCompanyMaterialCode(map);
		if(flag>0) {
			return ResponseUtil.ResponseResult("保存成功"); 
		}else {
			return ResponseUtil.ResponseError("保存失败"); 
		}
		
	}
	/**
	 * 通过公司物料信息.获取物料
	* @date 2018年4月18日 下午1:36:25 
	* @author 李斌
	* @return Map 
	* @throws
	 */
	@ResponseBody
	@RequestMapping("/getCompanyMaterialListByDetail")
	public Map getCompanyMaterialListByDetail(HttpServletRequest request) throws ServiceException {
		Map map = RequestUtil.getRequestAllParam(request);
		return ResponseUtil.ResponseResult(basicDataService.getCompanyMaterialByDetail(map));
	}
    /**
     * @author nateLu
     * 获取生产部门
     * @param request
     * @return
     * @throws ServiceException
     */
	@RequestMapping("/getProductionDepartment")
	@ResponseBody
	public Map getProductionDepartment(HttpServletRequest request) throws ServiceException{
		Map map = RequestUtil.getRequestAllParam(request);
		return ResponseUtil.ResponseResult(basicDataService.getProductionDepartment(map));
	}
	/**
	 * Description: 获取公共的物料类型  
	 * @param request
	 * @return
	 * @throws ServiceException  
	 * @author 王荣
	 */
	@RequestMapping("/getRowMaterialType")
	@ResponseBody
	public Map getRowMaterialType(HttpServletRequest request) throws ServiceException {
		Map map=RequestUtil.getRequestAllParam(request);
		return ResponseUtil.ResponseResult(basicDataService.getRowMaterialType(map));
	}
	
	/**
	 * Description: 获取物料类型  包含辅料
	 * @param request
	 * @return
	 * @throws ServiceException  
	 * @author nate
	 */
//	@RequestMapping("/getRowMaterialTypeIincludeAccessories")
//	@ResponseBody
//	public Map getRowMaterialTypeIincludeAccessories(HttpServletRequest request) throws ServiceException {
//		Map map=RequestUtil.getRequestAllParam(request);
//		return ResponseUtil.ResponseResult(basicDataService.getRowMaterialTypeIincludeAccessories(map));
//	}
	/**
	 * Description: 获取admin公司的部门信息,用于导入； 
	 * @param request
	 * @return
	 * @throws ServiceException  
	 * @author 王荣
	 */
	@RequestMapping("/getAdminDept")
	@ResponseBody
	public Map getAdminDept(HttpServletRequest request) throws ServiceException {
		Map map=RequestUtil.getRequestAllParam(request);
		return ResponseUtil.ResponseResult(basicDataMapper.getAdminDept(map));
	}
	/**
	 * Description: 导入部门  
	 * @param request
	 * @return
	 * @throws ServiceException  
	 * @author 王荣
	 */
	@RequestMapping("/importDept")
	@ResponseBody
	public Map importDept(HttpServletRequest request) throws ServiceException {
		Map map=RequestUtil.getRequestAllParam(request);
		basicDataService.importDept(map);
		return ResponseUtil.ResponseResult(ReturnStringUtil.ADD_SUCCESS);
	}
	/**
	 * Description: 获取admin公司的车间  
	 * @param request
	 * @return
	 * @throws ServiceException  
	 * @author 王荣
	 */
	@RequestMapping("/getAdminWorkshop")
	@ResponseBody
	public Map getAdminWorkshop(HttpServletRequest request) throws ServiceException {
		Map map=RequestUtil.getRequestAllParam(request);
		return ResponseUtil.ResponseResult(basicDataMapper.getAdminWorkshop(map));
	}
	/**
	 * Description: 导入车间  
	 * @param request
	 * @return
	 * @throws ServiceException  
	 * @author 王荣
	 */
	@RequestMapping("/importWorkshop")
	@ResponseBody
	public Map importWorkshop(HttpServletRequest request) throws ServiceException {
		Map map=RequestUtil.getRequestAllParam(request);
		basicDataService.importWorkshop(map);
		return ResponseUtil.ResponseResult(ReturnStringUtil.ADD_SUCCESS);
	}
	/**
	 * Description: 获取admin公司的工序表 
	 * @param request
	 * @return
	 * @throws ServiceException  
	 * @author 王荣
	 */
	@RequestMapping("/getAdminProcess")
	@ResponseBody
	public Map getAdminProcess(HttpServletRequest request) throws ServiceException {
		Map map=RequestUtil.getRequestAllParam(request);
		return ResponseUtil.ResponseResult(basicDataService.getAdminProcess(map));
	}
	/**
	 * Description: 导入工序  
	 * @param request
	 * @return
	 * @throws ServiceException  
	 * @author 王荣
	 */
	@RequestMapping("/importprocess")
	@ResponseBody
	public Map importprocess(HttpServletRequest request) throws ServiceException {
		Map map=RequestUtil.getRequestAllParam(request);
		basicDataService.importprocess(map);
		return ResponseUtil.ResponseResult(ReturnStringUtil.ADD_SUCCESS);
	}
	/**
	 * Description: 获取车间信息  
	 * @param request
	 * @return
	 * @throws ServiceException  
	 * @author 王荣
	 */
	@RequestMapping("/getWorkshopName2")
	@ResponseBody
	public Map getWorkshopName2(HttpServletRequest request) throws ServiceException {
		Map map=RequestUtil.getRequestAllParam(request);
		return ResponseUtil.ResponseResult(basicDataService.getWorkshopName2(map));
	}
	/**
	 * Description: 获取公司手机号  用于判断此手机号是否被使用（使用手机号登录时同一公司有两个相同的手机号会产生异常）
	 * @param request
	 * @return
	 * @throws ServiceException  
	 * @author 王荣
	 */
	@RequestMapping("/getPhoneNumber")
	@ResponseBody
	public Map getPhoneNumber(HttpServletRequest request) throws ServiceException {
		Map map=RequestUtil.getRequestAllParam(request);
		return ResponseUtil.ResponseResult(basicDataService.getPhoneNumber(map));
	}
	/**
	 * Description: 获取职务 
	 * @param request
	 * @return
	 * @throws ServiceException  
	 * @author 王荣
	 */
	@RequestMapping("/getDuty")
	@ResponseBody
	public Map getDuty(HttpServletRequest request) throws ServiceException {
		Map map=RequestUtil.getRequestAllParam(request);
		return ResponseUtil.ResponseResult(basicDataService.getDuty(map));
	}
	/**
	 * Description: 添加物料时，根据物料名称、规格、供应商、色号获取物料信息 ，能获取到则填入信息
	 * @param request
	 * @return
	 * @throws ServiceException  
	 * @author 王荣
	 */
	@RequestMapping("/getMaterialInfo")
	@ResponseBody
	public Map getMaterialInfo(HttpServletRequest request) throws ServiceException {
		Map map=RequestUtil.getRequestAllParam(request);
		return ResponseUtil.ResponseResult(basicDataService.getMaterialInfo(map));
	}
	
	/**
	 * 获取公司所有人员
	 * @author nate
	 * @param request
	 * @return
	 * @throws ServiceException
	 */
	@RequestMapping("/getUser")
	@ResponseBody
	public DatatablesViewPageBean getUser(HttpServletRequest request) throws ServiceException {
		Map map=RequestUtil.getRequestAllParam(request);
		return basicDataService.getUser(map);
	}
	
	/**
	 * 获取车间报报工审核人员
	 * @param workShopId
	 * @return
	 * @throws ServiceException  
	 * @author nate
	 */
	@RequestMapping("/getWorkShopApprovalReportUser")
	@ResponseBody
	public Map getWorkShopApprovalReportUser(HttpServletRequest request) throws ServiceException {
		Map map=RequestUtil.getRequestAllParam(request);
		return ResponseUtil.ResponseResult(basicDataService.getWorkShopApprovalReportUser(map));
	}
	
	
	/**
	 * 获取部门下没合并的车间
	 * @param deptId
	 * @return
	 * @throws ServiceException  
	 * @author nate
	 */
	@RequestMapping("/getDeptNoMegerWorkShop")
	@ResponseBody
	public Map getDeptNoMegerWorkShop(HttpServletRequest request) throws ServiceException {
		Map map=RequestUtil.getRequestAllParam(request);
		return ResponseUtil.ResponseResult(basicDataService.getDeptNoMegerWorkShop(map));
	}
	
	
	/**
	 * 设置车间审核人员
	 * @param workShopId
	 * @param userId
	 * @return
	 * @throws ServiceException  
	 * @author nate
	 */
	@RequestMapping("/setWorkShopApprovalReportUser")
	@ResponseBody
	public Map setWorkShopApprovalReportUser(HttpServletRequest request) throws ServiceException {
		Map map=RequestUtil.getRequestAllParam(request);
		basicDataService.setWorkShopApprovalReportUser(map);
		return ResponseUtil.ResponseResult(ReturnStringUtil.SET_SUCCESS);
	}
	
	/**
	 * Description: 上传图片 
	 * @param request
	 * @return
	 * @throws ServiceException  
	 * @author 王荣
	 */
	@RequestMapping("/uploadPic")
	public Map uploadPic(@RequestParam("file") MultipartFile files,HttpServletRequest request) throws IOException, ServiceException  {  
		Map map=RequestUtil.getRequestAllParam(request);
		SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
		String path = QiniuUploadUtils.uploadFileByStream(QiniuConfig.accessKey, QiniuConfig.secretKey,QiniuConfig.bucketShinehaopic,files.getInputStream(),null, QiniuConfig.bucketShinehaopicUrlPrefix);
		return ResponseUtil.ResponseResult(path);
	} 
	
	/**
	 * 通过客户名称获取客户信息
	* @date 2018年7月30日 下午4:48:54 
	* @author 李斌
	* @return Map<String,Object> 
	* @throws 
	 */
	@RequestMapping("/getCustomerBeanByCustomerName")
	@ResponseBody 
	public Map<String,Object> getCustomerBeanByCustomerName(HttpServletRequest request){
		Map<String,String> map = RequestUtil.getRequestAllParam(request);
		return ResponseUtil.ResponseResult(basicDataService.getCustomerBeanByCustomerName(map));
	}
	
	/**
	 * 获取出入库制单人
	* @date 2018年8月15日 下午2:48:52 
	* @author 李斌
	* @return Map<String,Object> 
	* @throws
	 */
	@RequestMapping("/getWarehouseInOutCreateUser")
	@ResponseBody 
	public Map<String,Object> getWarehouseInOutCreateUser(HttpServletRequest request){
		Map<String,Object> map = RequestUtil.getRequestAllParam(request);
		List<UserBean> createUserList = basicDataService.getWarehouseInOutCreateUser(map);
		return ResponseUtil.ResponseResult(createUserList);
	}
	/**
	 * 通过搜索条件获取公司职员简单信息
	 * @param request
	 * @author 王荣
	 */
	@RequestMapping("/getUserSimpleInfo")
	@ResponseBody
	public Map<String, Object> getUserSimpleInfo(HttpServletRequest request){
		Map<String, Object> requestMap = RequestUtil.getRequestParamByGeneric(request);
		return ResponseUtil.ResponseResult(basicDataService.getUserSimpleInfo(requestMap));
	}
	
	/**
	 * 审核物料
	 * @param materialBean
	 * @param request
	 * @return
	 */
	@RequestMapping("/approvalCompanyMaterial")
	@ResponseBody
	public Map<String,Object> approvalCompanyMaterial(CompanyMaterialTableBean materialBean,HttpServletRequest request){
		Map<String,Object> map = RequestUtil.getRequestAllParam(request);
		basicDataService.approvalCompanyMaterial(materialBean,map);
		return ResponseUtil.ResponseResult("操作成功");
	}
	
	@RequestMapping("/disableCompanyMaterial")
	@ResponseBody
	public Map<String,Object> disableCompanyMaterial(CompanyMaterialTableBean materialBean,HttpServletRequest request){
		Map<String,String> map = RequestUtil.getRequestAllParam(request);
		basicDataService.disableCompanyMaterial(materialBean,map);
		return ResponseUtil.ResponseResult("操作成功");
	}
	
	@RequestMapping("/disableAllCompanyMaterial")
	@ResponseBody
	public Map<String,Object> disableAllCompanyMaterial(HttpServletRequest request){
		Map<String,String> map = RequestUtil.getRequestAllParam(request);
		basicDataService.disableAllCompanyMaterial(map);
		return ResponseUtil.ResponseResult("操作成功");
	}
	
	@RequestMapping("/getBase64EncodeUTF8")
	@ResponseBody
	public Map testssg(HttpServletRequest request) throws IOException {
		Map<String,String> map = RequestUtil.getRequestAllParamNotLogin(request);
		return ResponseUtil.ResponseResult(PicUtils.getBase64EncodeUTF8(request, 
				"/weixin/temp",
				map.get("picUrl"), 
				600, 600, ".jpg"));
	}
}
